﻿$(function () {
    //绑定滚动条事件
    //绑定滚动条事件
    $(window).bind("scroll", function () {
        var sTop = $(window).scrollTop();
        var sTop = parseInt(sTop);
        if (sTop >= 44) {
            if (!$("#scrollSearchDiv").is(":visible")) {
                try {
                    $("#scrollSearchDiv").slideDown();
                } catch (e) {
                    $("#scrollSearchDiv").show();
                }
            }
        }
        else {
            if ($("#scrollSearchDiv").is(":visible")) {
                try {
                    $("#scrollSearchDiv").slideUp();
                } catch (e) {
                    $("#scrollSearchDiv").hide();
                }
            }
        }
    });
    for (var i = 0; i < tip.length; i++) {
        $('#tip' + (i + 1)).html(tip[i]);
        if (tip[i] != 0) {
            $('#tip' + (i + 1)).css('display', 'block');
        }
    }
});
$(function () {
    for (var i = 0; i < d1.length; i++) {
        $('#bd').append('<a href="/shop/product_dtl?code=' + d1[i].code + '" class="aui-list-product-item"><div class="aui-list-product-item-img"><img src="' + (d1[i].pic == '' ? '/themes/img/default.png' : d1[i].pic) + '"></div><div class="aui-list-product-item-text"><h3>' + d1[i].name + '</h3><div class="aui-list-product-mes-box"><div><span class="aui-list-product-item-price"><em>¥</em>' + d1[i].price_buy + '</span> <span class="aui-list-product-item-del-price">¥' + d1[i].price + '</span></div><div class="aui-comment">' + d1[i].comment_num + '评</div></div></div></a>');
    }
});
function showmyqr() {
    if (sc == 0) {
        txttip('您尚未达到T1或未创建店铺，请先去处理');
        return;
    }
    location.href = '/my/sharepic';
}
function showfriends() {
    if (f.length == 0) {
        return;
    }
    layer.open({
        title: false
    , content: '<div style="color:#fff;">左右滑动可查看更多<br>或者在"我的">"微信好友"查看<br>长按可保存图片</div><div id="sp" style="width:100%;height:auto;overflow-x:scroll;margin-top:10px;"></div>'
    });
    var s = '';
    for (var i = 0; i < f.length; i++) {
        s += '<td width="' + ($(window).width() * 0.9 - 60) + '"><img src="' + (f[i].m1 == 1 ? f[i].wxpic2 : f[i].wxpic1) + '" style="width:100%;max-width:100%;max-height:100%;"></td>';
    }
    $('#sp').css('width', ($(window).width() * 0.9 - 60) + 'px');
    $('#sp').html('<table width="' + ($(window).width() * 0.9 - 60) * f.length + '"><tr>' + s + '</tr></table>');
}